<?php
return [
    'server' => [
        'swConfig' => [
            'pid_file'              => runtime_path() . 'rpc-server.pid',
            'log_file'              => runtime_path() . 'rpc-server.log',
            'daemonize'             => false,
            'reactor_num'           => swoole_cpu_num(),
            'worker_num'            => swoole_cpu_num(),
            'task_worker_num'       => swoole_cpu_num(),
            'package_max_length'    => 20 * 1024 * 1024,
            'buffer_output_size'    => 10 * 1024 * 1024,
            'socket_buffer_size'    => 128 * 1024 * 1024,
            'max_wait_time'         => 3000
        ],
        'listener' => [
            'host' => '127.0.0.1',
            'port' => 8091,
            'mode' => SWOOLE_SOCK_TCP
        ],
        'listeners' => [
            'rpc_server' => [
                'host' => '127.0.0.1',
                'port' => 8098,
                'timeout' => 0.5,
                'mode' => SWOOLE_SOCK_TCP,
                'options' => 'default' // default / array
            ]
        ],
        'listener_default_name' => 'rpc_server',
        'client_name' => 'MASTER',
        // client list cache
        'cluster' => [
            'type' => 'table', // redis | table
            // second
            'expired' => 0,
            'fields' => [
                [ 'name' => 'fd', 'type' => \Swoole\Table::TYPE_INT ],
                [ 'name' => 'host', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 1024 ],
                [ 'name' => 'name', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 1024 ],
            ]
        ],
        'websocket' => [
            'enable' => true,
            'ping_interval' => 25000,
            'ping_timeout'  => 60000,
            'fields' => [
                [ 'name' => 'fds', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 1024 ],
                [ 'name' => 'name', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 1024 ]
            ]
        ],
        'event' => \iflow\swoole\implement\Server\Rpc\Events\Event::class,
        'packet' => \iflow\swoole\implement\Server\Rpc\Parsers\Packet::class,
        'keep_alive' => 10,
        'heartbeat' => [
            'ping_interval' => 25000,
            'ping_timeout'  => 60000,
        ]
    ],
    'client' => [
        'swConfig' => [
            'pid_file'              => runtime_path() . 'rpc-client.pid',
            'log_file'              => runtime_path() . 'rpc-client.log',
            'daemonize'             => false,
            'reactor_num'           => swoole_cpu_num(),
            'worker_num'            => swoole_cpu_num(),
            'task_worker_num'       => swoole_cpu_num(),
            'package_max_length'    => 20 * 1024 * 1024,
            'buffer_output_size'    => 10 * 1024 * 1024,
            'socket_buffer_size'    => 128 * 1024 * 1024
        ],

        // client connection info
        'listener' => [
            'host' => '127.0.0.1',
            'port' => 8099,
            'mode' => SWOOLE_SOCK_TCP
        ],

        'listeners' => [
            'rpc_server' => [
                'host' => '127.0.0.1',
                'port' => 8082,
                'timeout' => 0.5,
                'mode' => SWOOLE_SOCK_TCP,
                'options' => 'default' // default / array
            ]
        ],

        'listener_default_name' => 'rpc_server',

        // client list cache
        'cluster' => [
            'type' => 'table', // redis | table
            // second
            'expired' => 0,
            'fields' => [
                [ 'name' => 'fd', 'type' => \Swoole\Table::TYPE_INT ],
                [ 'name' => 'host', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 1024 ],
                [ 'name' => 'name', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 1024 ],
            ]
        ],

        // bind server info
        'server' => [
            'host' => '127.0.0.1',
            'port' => 8098,
            'mode' => SWOOLE_SOCK_TCP,
            'keep_alive' => 10,
            're_connection' => 1000,
        ],

        'websocket' => [
            'enable' => true,
            'ping_interval' => 25000,
            'ping_timeout'  => 60000,
            'fields' => [
                [ 'name' => 'fds', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 1024 ],
                [ 'name' => 'name', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 1024 ]
            ]
        ],

        // rpc client name
        'client_name' => 'RPC-TEST',

        // client request react before event
        'event' => \iflow\swoole\implement\Server\WebSocket\Event\Events::class,
        'packet' => \iflow\swoole\implement\Server\Rpc\Parsers\Packet::class
    ]
];